package org.p2psimulator.entity.reputation.gnutellabased;

import org.p2psimulator.engine.Environment;
import org.p2psimulator.entity.Id;
import org.p2psimulator.entity.Network;
import org.p2psimulator.entity.reputation.ReputationManager;
import org.p2psimulator.entity.reputation.ReputationRepository;
import org.p2psimulator.entity.reputation.ReputationRepositoryTypes;
import org.p2psimulator.exceptions.ReputationManagerException;

public class XrepReputationManager extends ReputationManager {

    public XrepReputationManager() {
    }

    @Override
    public void loadRepositories(Environment env) throws ReputationManagerException {

        this.env = env;
        repositoryMap.put(ReputationRepositoryTypes.REP_SERVENT_REPOSITORY,
                new ReputationRepository(this, env));


        repositoryMap.put(ReputationRepositoryTypes.XREP_RESOURCE_REPOSITORY,
                new ReputationRepository(this, env));

        for (Id id : env.getPeerBank().getPeerMap().keySet()){
            repositoryMap.get(ReputationRepositoryTypes.REP_SERVENT_REPOSITORY).addServent(id);
            repositoryMap.get(ReputationRepositoryTypes.XREP_RESOURCE_REPOSITORY).addServent(id);
        }
    }
}
